<template>
    <div class="cont">
        <CustomForm @submit="submit" title="添加运营城市" :formList="formList"></CustomForm>
    </div>
</template>

<script setup lang="ts">
import CustomForm from '@/components/customForm/CustomForm.vue';
import { CustomFormItem, CustomFormState } from '@/components/customForm/types';

const formList = reactive<CustomFormItem[]>([
    {
        label: '运营城市', key: 'location', type: 'cascader', required: true, options: [
            {
                value: 'zhejiang',
                label: 'Zhejiang',
                children: [
                    {
                        value: 'hangzhou',
                        label: 'Hangzhou',
                        children: [
                            {
                                value: 'xihu',
                                label: 'West Lake',
                            },
                        ],
                    },
                ],
            },
            {
                value: 'jiangsu',
                label: 'Jiangsu',
                children: [
                    {
                        value: 'nanjing',
                        label: 'Nanjing',
                        children: [
                            {
                                value: 'zhonghuamen',
                                label: 'Zhong Hua Men',
                            },
                        ],
                    },
                ],
            },
        ]
    },
    {label:'平台抽点',key:'platformDrawPoints',type: 'drawSome',tip:'输入小于1的数值'},
    {label:'代理抽点',key:'proxyDrawPoints',type: 'drawSome',tip:'输入小于1的数值'},
    {label:'起步价',key:'startingPrice',type: 'number',tip:'输入小于1的数值',value:'0'},
    {label:'计划规则',key:'planningRules',type: 'select'},
    {label:'重量标签',key:'weightLabel',type: 'select'},
    {label:'物品标签组',key:'itemLabelGroup',type: 'select'},
    {label:'代理人',key:'agent',type: 'select'},
    {label:'运营状态',key:'state',type: 'radio',disabled:true,options:[
        { label: '运营', value: '1' },
        { label: '关闭', value: '0' },
    ],value:'0'},
    { value: '提交并保存', key: 'submit', type: 'submit' }
])

const submit = (formState: CustomFormState) => {
    alert('表单结果为' + JSON.stringify(formState))
}
</script>

<style scoped></style>